#!/usr/bin/env bash

# 阿拉伯数字18作为异常退出码
check='[ $? -eq 0 ] || exit 18'

eval "$check" && echo 'start aurelia building...'

if [ ! -d "min" ];then
  eval "$check" && echo '检出代码'
  eval "$check" && git clone https://gitee.com/siusn/aurelia.git min
  eval "$check" && echo '进入min目录'
  eval "$check" && cd min
  eval "$check" && echo '安装依赖和启动工具'
  eval "$check" && npm install -g serve
  eval "$check" && cnpm i
  eval "$check" && echo '编译'
  eval "$check" && npm run build
else
  echo "min 目录已存在"
  echo "此处认为项目已经过编译，不再进行编译，如还需编译，可删除【min】目录后重试"
fi

eval "$check" && echo "finish aurelia building！！！"